﻿using CasignDesignGA.Casing;
using CasignDesignGA.Casing.CasignGenerator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CasignDesignGA.Engine.Population
{
    class MockPopulationFactory : IPopulationFactory
    {
        ICasingGenerator casingGenerator;
        public MockPopulationFactory(long populationGenoma)
        {
            this.casingGenerator = new MockCasignGenerator(populationGenoma);
        }
        public Population generatePopulation(long populationSize)
        {
            List<ISelectable> casingCollection = new List<ISelectable>();
            Population pop =  new Population();
            for (int i = 0; i < populationSize; i++)
            {
                casingCollection.Add(this.casingGenerator.generateRandomCasing());
            }

            pop.Individuals = casingCollection;
            return pop;
        }


        public Population generatePopulation(long populationSize, double designFactor)
        {
            List<ISelectable> casingCollection = new List<ISelectable>();
            Population pop = new Population();
            for (int i = 0; i < populationSize; i++)
            {
                casingCollection.Add(this.casingGenerator.generateRandomCasing());
            }

            pop.Individuals = casingCollection;
            return pop;
        }
    }
}
